import fetch from 'common/src/utils/fetch'
import UTILS from "common/src/utils/utils";

/**
 * 删除
 */
function delete_(idList) {
    return fetch({
        url: `/api/electionservice/ElcStuCourseLevel/delete`,
        method: 'post',
        data: idList
    });
}

/**
 * 新增
 */
function add(data) {
    return fetch({
        url: `/api/electionservice/ElcStuCourseLevel/add`,
        method: 'post',
        data: data
    });
}

/**
 * 更新
 */
function update(data) {
    return fetch({
        url: `/api/electionservice/ElcStuCourseLevel/update`,
        method: 'post',
        data: data
    });
}

/**
 * 下载模板
 */
function downTemplate(){
    return fetch({
        url: `/api/electionservice/ElcStuCourseLevel/download`,
        method: 'get',
        responseType: 'blob'
    }).then(res => {
        UTILS.downloadFile(res, '学生课程能力.xls', 'application/vnd.ms-excel;charset=utf-8');
    });
}

export default {
    "pageUrl": '/api/electionservice/ElcStuCourseLevel/page',
    "delete_": delete_,
    "update": update,
    "add": add,
    "downTemplate": downTemplate
}
